package com.mgface.mrmdb.controller;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/mrmdb")
public class TestController {
	@RequestMapping(value = "/list", method = { RequestMethod.POST,RequestMethod.GET })
	public String test(HttpServletRequest request,HttpServletResponse response) {
		System.out.println(request.getSession().isNew()+"|"+request.getSession().getId());
		System.out.println(request.getLocale());
		Cookie paramCookie = new Cookie("lastTime", String.valueOf(System.currentTimeMillis()));
		paramCookie.setHttpOnly(true);
		response.addCookie(paramCookie);
		System.out.println(request.getHeaderNames());
		Cookie[] cookies = request.getCookies();
		for(Cookie cookie:cookies){
			System.out.println(cookie.getName()+"|"+cookie.getValue()+"|"+cookie.getSecure());
		}
		return "list";
	}
}
